<?php
session_start();
include 'class/class.trangchu.php';
$tc = new trangchu();

if(@$_POST['guiykien']){
	$tc->guiykien($_POST['form'],$_POST['id'],$_POST['name'],$_POST['email'],$_POST['content']);
}

/*
* DOn hang
*/
if(@$_POST['buy']){
	$id = $_POST["id"];
	$sanpham = mysql_query("SELECT id,name,price FROM product WHERE id={$id}");
	$row_sp = mysql_fetch_array($sanpham);
	$_SESSION['name'][$row_sp['id']] = $row_sp['name'];
	$_SESSION['price'][$row_sp['id']] = $row_sp['price'];
	$_SESSION['daySoLuong'][$row_sp['id']] += 1;
	echo count($_SESSION['name']);
}
if(@$_POST['trash']){
	$id = $_POST["id"];
	unset($_SESSION['name'][$id]);
	unset($_SESSION['price'][$id]);
	unset($_SESSION['daySoLuong'][$id]);
}
if(@$_POST['soluong']){
	$id = $_POST["id"];
	$soluong = $_POST["soluong"];
	$_SESSION['daySoLuong'][$id] = $soluong;
}
if(@$_POST['huydh']){
	session_destroy();
}